// I love Marauders forever
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int n,a,buc[N],s[N],cnt=0;
int main(){
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a);
		buc[a]++;
	}
	for(int i=1;i<=1e5;i++){
		if(buc[i]){
			s[++cnt]=buc[i];
		}
	}
	int ans=0,cur=1;
	for(int i=2;i<=cnt;i++){
		if(s[i]>=s[cur]){
			int k=s[i]-s[cur];
			s[cur]=0;
			cur++;
			//s[cur]-k maybe minus
			if(i!=cur){
				while(i>cur){
					if(k>=s[cur])
						k-=s[cur],s[cur]=0;
					else{
						s[cur]-=k,k=0;
						break;
					}
					cur++;
				}
			}
		}
		else{
			s[cur]-=s[i];
		}
	}
	for(int i=1;i<=cnt;i++)ans+=s[i];
	cout<<ans<<endl;
	return 0;
}
